<h1>Listing requests</h1>

<table>
  <tr>
    <th>User</th>
    <th>Book</th>
    <th>Request time</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>
<% i=0%>
<% @requests.each do |request| %>
<% abook=@books[i]%>
<% i+=1 %>
  <tr>
    <td><%= request.user_id %></td>
    <td><%= request.book_id %></td>
    <td><%= request.request_time %></td>
    <td><%= abook.quantity %></td>
    <td><%= link_to 'Show', request %></td>
    <td><%= link_to 'Edit', edit_request_path(request) %></td>
    <td><%= link_to 'Destroy', request, method: :delete, data: { confirm: 'Are you sure?' } %></td>
    <td><button onclick="return Check() ">Check</button></td>
  </tr>
  <script>
  	function Check() {
  		alert("Test");
  	}
  </script>
<% end %>
</table>

<br />

<%= link_to 'New Request', new_request_path %>
